//
//  TestBaseORM.m
//  JhonSell
//
//  Created by Mario Montoya on 17/04/09.
//  Copyright 2009 El malabarista. All rights reserved.
//

#import "TestBaseORM.h"

@implementation TestBaseORM

-(void) setUp {
	NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];	
    NSString *path = [documentsDirectory stringByAppendingPathComponent:@"sample.db"];	

	
	if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {
		ALog(@"Deleting test database");
		[[NSFileManager defaultManager] removeItemAtPath:path error:nil];
	}
	
	Db *db = [[Db alloc] initWithName:path];		
	[db createDb];		
	[db release];
}

- (BOOL)shouldRunOnMainThread { 
	return YES;
}

@end
